﻿using CPPEI.Coolzon.UI.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CPPEI.Coolzon.UI.Views
{
    /// <summary>
    /// Interaction logic for PopView.xaml
    /// </summary>
    public partial class PopView : UI.View
    {
        View _contentView;
        
        public View ContentView
        {
            get
            {
                return _contentView;
            }
        }

        public PopView(View contentView)
        {
            InitializeComponent();

            _contentView = contentView;
            _contentView.Close += _contentView_Close;
            _ctlBorderContainer.Child = contentView;
        }

        /// <summary>
        /// 获得弹出视图中显示的场景名称
        /// </summary>
        /// <returns></returns>
        public string GetSceneName()
        {
            return (_contentView.Tag as Metadata.Scene).Name;
        }

        void _contentView_Close(View view, bool isCancel)
        {
            Submit();
        }

        private void _ctlBtnClose_Click(object sender, RoutedEventArgs e)
        {
            //Coolzon.Event..EventBus.Instance.Publish(new Event.CloseSceneEvent(SwitchMode.Pop, "root", GetSceneName()));
            //_contentView.Submit();
        }

        public void SetTitle(string title)
        {
        }
    }
}
